<html>
<head><meta charset="utf-8"><title>False Positives section in the Readme? · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html">False Positives section in the Readme?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223563825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223563825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223563825">(Jan 21 2021 at 20:09)</a>:</h4>
<ol>
<li>(Attempt to) Explain the difference between a false positive bug and a "special case" false positive. Say what to do in each case (file a bug or <code>allow</code>)</li>
<li>Give a concrete example of using <code>allow</code> with a "why" comment to suppress a single lint. This is a good practice that we can teach and encourage.</li>
</ol>
<p>This would at least partially address <a href="https://github.com/rust-lang/rust-clippy/issues/6535">rust-lang/rust-clippy#6535</a>.<br>
Of course we don't want to scare people away from filing bugs, but this also might reduce bug reports like "clippy linted and I didn't want it to" <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span>.<br>
Thoughts?</p>



<a name="223568262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223568262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223568262">(Jan 21 2021 at 20:48)</a>:</h4>
<p>I think this could be good! Maybe try to simply focus on the separation between these. Having a configuration or enhancing a lint for a "special case" can be a helpful feature request. So, maybe focus on the correct categorization for issues. Or have I misunderstood your focus <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="223568808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223568808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223568808">(Jan 21 2021 at 20:53)</a>:</h4>
<p>Well I don't know if "special case" is the best term. I'm talking about instances where clippy is 100% right to lint but the user is also 100% right to <code>allow</code> it because of the context.</p>
<p>For example, I just saw a comment about something like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[test]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">test_partial_eq</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">assert_eq!</span><span class="p">(</span><span class="n">foo</span><span class="p">(),</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"> </span><span class="c1">// fires `eq_op` lint</span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="223568912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223568912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223568912">(Jan 21 2021 at 20:54)</a>:</h4>
<p>Now, maybe we could add a condition for <code>#[test]</code>, but sometimes there is no opportunity for adding a condition. So there's a challenge here to find a perfect example.</p>



<a name="223569140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223569140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223569140">(Jan 21 2021 at 20:56)</a>:</h4>
<p>But rather than categorization of issues, I am saying that an issue should not be opened at all, unless there is some perceivable way for clippy to detect and avoid the false positive. But again, people should be encouraged to open an issue if in doubt.</p>



<a name="223569494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223569494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223569494">(Jan 21 2021 at 20:59)</a>:</h4>
<p>Basically provide guidance for: "Should I just <code>allow</code> this? Or is this a clippy bug?"</p>



<a name="223569503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223569503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223569503">(Jan 21 2021 at 20:59)</a>:</h4>
<p>Hmmm, this is a complicated task you set yourself there ^^<br>
I would actually say that the example you gave here is worth an issue but should be labeled enhancement instead of FP. But this can not be generalized. I've also seen some issues about correct clippy behavior</p>



<a name="223571397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223571397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223571397">(Jan 21 2021 at 21:15)</a>:</h4>
<blockquote>
<p>there is some perceivable way for clippy to detect and avoid the false positive</p>
</blockquote>
<p>The problem with this is, that people don't know what Clippy can detect and what it can't detect.</p>
<p>Finding such an example is also hard, because, as you said, this is a special case, which is specific to a code base. </p>
<p>If there is an example where a lint should generally be allowed, then it is a FP and not an example for a special case.  So we're going in circles here, I think.</p>



<a name="223576887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223576887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223576887">(Jan 21 2021 at 22:01)</a>:</h4>
<p>I just noticed, that I'm too negative today. I think documenting/defining this is a good idea. Finding an example might be hard though.</p>



<a name="223602409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223602409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Wright <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223602409">(Jan 22 2021 at 04:18)</a>:</h4>
<p>The "special case" false positives aren't false positives at all. If you have a lint called <code>metal</code> it should detect <code>metal</code> everywhere. It's not a false positive for a metal detector to detect keys even if you're using it to try to find guns.</p>



<a name="223603585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223603585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Wright <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223603585">(Jan 22 2021 at 04:46)</a>:</h4>
<p>That said I think lints should still be changed to reduce unhelpful warnings if possible. As long as it doesn't change what the lint it about.</p>



<a name="223648437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223648437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223648437">(Jan 22 2021 at 14:35)</a>:</h4>
<p>Great analogy. I'll have to think on this a little more and look for a good example. I may have to use a pedantic lint.</p>



<a name="223653360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/False%20Positives%20section%20in%20the%20Readme%3F/near/223653360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/False.20Positives.20section.20in.20the.20Readme.3F.html#223653360">(Jan 22 2021 at 15:10)</a>:</h4>
<p>to me anything written suggesting confusions <br>
shouldn't be brought forward isn't ideal</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>